{template 'common/header'}
<ul class="nav nav-tabs">
    <li><a href="{php echo $this->createWebUrl('order', array('op'=>'display'));}">返回运单列表</a></li>
    <li><a href="{php echo $this->createWebUrl('detail', array('op'=>'display' , 'oid' => $oid));}">物流跟踪列表</a></li>
    <li class="active"><a href="">{if empty($id)}添加物流跟踪{else}编辑物流跟踪{/if}</a></li>
</ul>

<div class="main">
    <form action="" method="post" class="form-horizontal form" id="form">
        <div class="panel panel-default">

            {if empty($id)}
            <div class="panel-heading">添加物流跟踪</div>
            {else}
            <div class="panel-heading">编辑物流跟踪 订单编号：{php echo $order['orderId']}</div>
            {/if}
            <div class="panel-body">
                <div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-2 col-lg-2 control-label"><span style='color:red'>*</span>地点和跟踪进度：</label>
                    <div class="col-xs-12 col-sm-8">
                        <input style="width: 100%;" type="text" name="detail[progress]" class="form-control" value="{$detail['progress']}" />
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-2 col-lg-2 control-label"><span style='color:red'>*</span>时间：</label>
                    <div class="col-xs-12 col-sm-8">
                           {php echo _tpl_form_field_date('detail[createdAt]' , '' , true);}
                    </div>
                </div>

                <div class="form-group">
                    <div class="col-xs-12 col-sm-9 col-md-10 col-lg-10 col-sm-offset-3 col-md-offset-2 col-lg-offset-2">
                        <input type="hidden" name="id" value="{$detail['id']}" />
                        <input name="submit" type="submit" value="提交" class="btn btn-primary" />
                        <input type="hidden" name="token" value="{$_W['token']}" />
                    </div>
                </div>
            </div>
        </div>
    </form>
</div>

<script>
require(['jquery', 'util'], function($, util){
    $(function(){
        $('#form').submit(function(){
            if($('input[name="detail[progress]"]').val() == ''){
                util.message('地点和跟踪进度.');
                return false;
            }
            if($('input[name="detail[createdAt]"]').val() == ''){
                util.message('请填写时间.');
                return false;
            }
            return true;
        });
    });
});
require(['jquery', 'util'], function($, u){
    $(function(){
        u.editor($('.richtext')[0]);
    });
});
</script>

{template 'common/footer'}